/*
 * Copyright 2008-2010 Daniel Cachapa <cachapa@gmail.com>
 * 
 * This program is distributed under the terms of the GNU General Public License Version 3
 * The license can be read in its entirety in the LICENSE.txt file accompanying this source code,
 * or at: http://www.gnu.org/copyleft/gpl.html
 * 
 * This file is part of Libra.
 *
 * WeightWatch is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * WeightWatch is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with the WeightWatch source code. If not, see: http://www.gnu.org/licenses
 */

package net.cachapa.libra.component;

import net.cachapa.libra.Main;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.Gallery;

public class ChartGallery extends Gallery {
	private Main parent;
	
	public ChartGallery(Context context) {
		super(context);
	}
	
	public ChartGallery(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public ChartGallery(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}
	
	public void setParent(Main parent) {
		this.parent = parent;
	}
	
	

	@Override
	protected void onSizeChanged(int w, int h, int oldw, int oldh) {
		parent.onGallerySizeChanged(w, h);
		super.onSizeChanged(w, h, oldw, oldh);
		removeAllViewsInLayout();
	}
}
